package com.firefly.service.repository.cms;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.firefly.dao.dao.cms.po.AdPosPo;
import com.firefly.dao.dao.cms.service.AdPosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description: 广告位
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2022/12/18
 **/
@Repository
public class AdPosRepository {
    private final AdPosService adPosService;
    @Autowired
    public AdPosRepository(AdPosService adPosService){
        this.adPosService = adPosService;
    }

    public Boolean create(AdPosPo entity){
        return adPosService.save(entity);
    }

    public Boolean update(AdPosPo entity){
        return adPosService.updateById(entity);
    }

    public Boolean updateDelFlagByIds(List<Integer> ids){
        UpdateWrapper<AdPosPo> updateWrapper = new UpdateWrapper<>();
        updateWrapper.in("id",ids).set("del_flag",1);
        return adPosService.update(updateWrapper);
    }
}
